<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

$api=app(\Dingo\Api\Routing\Router::class);
#默认配置指定的是v1版本，可以直接通过 {host}/api/version 访问到
$api->version('v1',['namespace' => 'App\Http\Controllers\Api'], function ($api) {
	$api->get('version',function(){
		return 'v1';
	});
	$api->get('articles','ArticleController@articles');
	$api->get('article/{id}','ArticleController@article');
	$api->post('login', 'AuthController@login');
	$api->get('logout', 'AuthController@logout');
	$api->get('me','AuthController@me');
	$api->get('categorys','CategoryController@categorys');
});
